<extend name="layout/main" />

<block name="HEADER">

</block>

<block name="CONTENT">
    <div class="wrapper">
        <div class="panel-heading">
        	<control:search id="searchs" />
        </div>
        <div class="content" >
            <control:grid  id="grid" padding="0"  height="100%"  />
        </div>
    </div>
</block>

<block name="FOOTER">
    <script type="text/javascript">
    	var page=(function(ns){
    
            //页面初始化
            ns.init=function(){
                grid.load(searchs.getData());
                searchs.query(function(filter){
                    grid.load(filter);
                });
            }
            
            //初始化搜索事件
            ns.initSearch=function(){
                searchs = layui.search.render({
                    id:"search",
                    query:[
                        {type:"text",field:"url",name:"访问路径",opera:"like",value:""},
                        {type:"text",field:"user_name,user_code",name:"访问用户,用户编码",opera:"like",value:""},
                        {field:"create_time",name:"访问时间",opera:"=",type:"datetime",value:""},
                        {type:"radio",field:"state",name:"状态",opera:"like",value:"",options:[
                            {value: '',label: '全部'},
                            {value: '成功',label: '成功'},
                            {value: '错误',label: '错误'}
                        ]}
                    ]
                });
            }
            
            // 删除选中行
            ns.del=function(){
                grid.deleteSelectRow(); 
            }
            
            //清空
            ns.empty = function(){
                $.confirm("确定清空？",function(index){
                    $.ajaxs("/admin/v1/Log/emptyAll").then(function(){
                        grid.load();
                    });
                    layer.close(index);
                });
            }
            
            return ns;
        }({}));
        
        $(function(){ page.init(); });
    </script>
</block>



